import React, { useState, useEffect } from 'react';
import { Form, Row, Col, DatePicker, Select, Input } from 'antd';
import { isnullObj } from '../../Control/deepCopy';
import styles from './index.css';

const { RangePicker } = DatePicker;
const { Option } = Select;

function SignInForm(props) {
  // console.log(props);

  useEffect(() => {
    if (!isnullObj(props.formData)) {
      props.formData.signInType = '' + props.formData.signInType;
      props.form.setFieldsValue(props.formData);
    }
  }, []);

  return (
    <div className={styles.SignInForm}>
      <Form
        form={props.form}
        name="SignInForm"
        autoComplete="off"
        initialValues={{
          SignInDate: props.activityDate,
        }}
        // onFinish={finishBasicData}
      >
        <div className={styles.firstDesc}>基本信息</div>

        <Row className={styles.FromRow}>
          <Col span={10}>
            <Form.Item
              name={`SignInDate`}
              label={`活动时间`}
              labelAlign={'left'}
              labelCol={{ span: 24, offset: 0 }}
              rules={[
                {
                  required: true,
                  message: '请选择时间',
                },
              ]}
            >
              <RangePicker
                showTime={{ format: 'HH:mm' }}
                format="YYYY-MM-DD HH:mm"
              />
            </Form.Item>
          </Col>
          <Col span={10}>
            <Form.Item
              name={`signInType`}
              label={`投票方式`}
              labelAlign={'left'}
              labelCol={{ span: 24, offset: 0 }}
              initialValue={'1'}
              rules={[
                {
                  required: true,
                  message: '',
                },
              ]}
            >
              <Select className={styles.StandardWidth}>
                <Option value="1">线上签到</Option>
                <Option value="2">线下签到</Option>
              </Select>
            </Form.Item>
          </Col>
        </Row>
      </Form>
    </div>
  );
}
export default SignInForm;
